<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>员工信息编辑</title>
</head>
<link rel="stylesheet" type="text/css" href="/wms/js/plugins/jquery-easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/wms/js/plugins/jquery-easyui/themes/icon.css">
<script type="text/javascript" src="/wms/js/plugins/jquery-easyui/jquery.min.js"></script>
<script type="text/javascript" src="/wms/js/plugins/jquery-easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/wms/js/plugins/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/wms/js/common/common.js"></script>
<script type="text/javascript">
$(function() {
	$("#editForm").submit(function() {
		var validate = $("#editForm").form('validate');
		if (!validate) {
			return false;
		}
		$("#rightSelect option").prop("selected", true);
	});
});
/*校验规则*/
$(function() {
	$(":input[name='employee.name']").textbox({
		required:true,
		missingMessage:'姓名必填'
	});
 	$(":input[name='employee.password']").passwordbox({
		required:true,
		missingMessage:'密码必填'
	});
	$(":input[name='employee.email']").textbox({
		required:true,
		missingMessage:'邮箱必填',
		validType:'email',
		invalidMessage:'请填写正确的邮箱格式'
	});
	$(":input[name='employee.age']").numberbox({
		required:true,
		missingMessage:'年龄必填',
		min:16,
		max:80
	});
	$(":input[name='employee.dept.id']").combobox({
		width:140,
		panelHeight:null,
		editable:false
	});
});
</script>
<body>
	<s:if test="hasActionErrors()">
		<script type="text/javascript">
			$.messager.alert('操作提示', '<s:property value="actionErrors[0]"/>', 'error');
		</script>
	</s:if>
	<form id="editForm" method="POST" action="/wms/employee_saveOrUpdate.action">
		<s:hidden name="employee.id"/>
		<table style="table-layout:fixed;">
			<tr>
				<td width="40px">姓名</td>
				<td><s:textfield name="employee.name"/></td>
			</tr>
			<s:if test="employee.password == null">
				<tr>
					<td>密码</td>
					<td><s:password name="employee.password"/></td>
				</tr>
			</s:if>
			<tr>
				<td>邮箱</td>
				<td><s:textfield name="employee.email"/></td>
			</tr>
			<tr>
				<td>年龄</td>
				<td><s:textfield name="employee.age"/></td>
			</tr>
			<tr>
				<td>部门</td>
				<td><s:select name="employee.dept.id" list="#depts" listKey="id" listValue="name"/></td>
			</tr>
			</table>
			<table>
				<tr>
					<td align="center" colspan="3">角色分配</td>
				</tr>
				<tr>
					<td>
						<s:select id="leftSelect" list="#roles" listKey="id" listValue="name" multiple="true"
						style="width: 180px; height: 225px"></s:select></td>
					<td align="center" style="width: 10px">
					<a class="easyui-linkbutton" data-options="text:'-->',onClick:move"></a><br /> 
					<a class="easyui-linkbutton" data-options="text:'==>',onClick:moveAll"></a><br />
					<a class="easyui-linkbutton" data-options="text:'<--',onClick:move"></a><br />
					<a class="easyui-linkbutton" data-options="text:'<==',onClick:moveAll"></a><br /></td>
					<td>
						<s:select id="rightSelect" list="employee.roles" listKey="id" listValueKey="name" name="employee.roles.id" data-url="/wms/employee_employeeRoles.action" multiple="true"
						style="width: 180px; height: 225px"></s:select>
					</td>
				</tr>
			
			</table>
			<a class="easyui-linkbutton" data-options="text:'保存',iconCls:'icon-ok',onClick:saveOrUpdate"></a>
			<a class="easyui-linkbutton" data-options="text:'取消',iconCls:'icon-cancel',onClick:cancel"></a>
	</form>
</body>
</html>
